pub(crate) mod aligned_buffer;
pub mod bitmaps;
pub mod color;
pub(crate) mod color_matrix;
pub(crate) mod copy_rect;
pub mod flip;
pub(crate) mod histogram;
pub(crate) mod math;
pub mod scaling;
pub mod transpose;
pub mod weights;
pub mod whitespace;
//pub(crate) mod convolve;
pub(crate) mod blend;
pub(crate) mod rounded_corners;

//pub mod faces;

#[doc(hidden)]
mod prelude {
    pub(crate) use crate::errors::ErrorKind;
    pub(crate) use crate::ffi::BitmapCompositingMode;
    pub(crate) use crate::FlowError;

    #[cfg(target_arch = "x86")]
    pub(crate) use std::arch::x86::{
        __m128, _mm_add_ps, _mm_loadu_ps, _mm_movehl_ps, _mm_movelh_ps, _mm_mul_ps, _mm_set1_ps,
        _mm_setr_ps, _mm_setzero_ps, _mm_storeu_ps, _mm_unpackhi_ps, _mm_unpacklo_ps,
    };
    #[cfg(target_arch = "x86_64")]
    pub(crate) use std::arch::x86_64::{
        __m128, _mm_add_ps, _mm_loadu_ps, _mm_movehl_ps, _mm_movelh_ps, _mm_mul_ps, _mm_set1_ps,
        _mm_setr_ps, _mm_setzero_ps, _mm_storeu_ps, _mm_unpackhi_ps, _mm_unpacklo_ps,
    };

    #[cfg(target_arch = "aarch64")]
    pub(crate) use std::arch::aarch64::*;

    pub(crate) use crate::graphics::aligned_buffer::AlignedBuffer;
    pub(crate) use crate::graphics::bitmaps::{Bitmap, BitmapWindowMut, ColorSpace, PixelLayout};
    pub(crate) use crate::graphics::color::{
        flow_colorcontext_floatspace_to_srgb, uchar_clamp_ff, ColorContext, WorkingFloatspace,
    };
    pub(crate) use crate::graphics::weights::{PixelRowWeights, PixelWeightIndexes};

    pub(crate) use imageflow_types::PixelFormat;

    pub(crate) fn flow_pixel_format_bytes_per_pixel(format: crate::ffi::PixelFormat) -> u32 {
        format.bytes() as u32
    }
    pub(crate) fn flow_pixel_format_channels(format: crate::ffi::PixelFormat) -> u32 {
        match format {
            PixelFormat::Bgra32 => 4,
            PixelFormat::Bgr32 => 3,
            PixelFormat::Bgr24 => 3,
            PixelFormat::Gray8 => 1,
        }
    }
}
